Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit abab8ec787be5ce83cc86f09fafec6f11bef4c4d


Parents : 7ce2855
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Signature : T66BB85Valid, signed by author
Date : 2026-07-16T14:16:15+02:00

Incoming messages status

Changes

3 files changed, 97 insertions(+), 30 deletions(-)

M sbapp/main.py +3 -28

Diff

diff --git a/sbapp/main.py b/sbapp/main.py
index afd8f108..fb22cfad 100644
--- a/sbapp/main.py
+++ b/sbapp/main.py
@@ -2982,34 +2982,11 @@ class SidebandApp(MDApp):
Clock.schedule_once(cb, 0.10)
def get_incoming_messages_text(self):
- try:
- if not self.sideband.message_router: return "LXMF router starting..."
- else:
- inbound_count = self.sideband.message_router.inbound_count()
- if inbound_count == 0: return "No incoming messages"
- else:
- inbound = self.sideband.message_router.inbound_resources()
- if len(inbound) == 0: return "No incoming messages"
- else:
- text = f"[b]Receiving {inbound_count} message resource{'s' if inbound_count != 1 else ''}[/b]"
- size = 0
- prgr = 0
- for r in inbound:
- size += r.get_data_size()
- prgr += r.get_progress()
-
- prgr = prgr/len(inbound)
- text += f"\nTotal size : {RNS.prettysize(size)}"
- text += f"\nProgress : {round(prgr*100, 2)}%"
- return text
-
- except Exception as e:
- RNS.log(f"Error getting incoming messages information: {e}", RNS.LOG_ERROR)
- return "Error getting incoming messages information"
+ return self.sideband.incoming_messages_status()
def cancel_incoming_action(self, sender=None):
RNS.log(f"Cancelling all inbound message resources", RNS.LOG_NOTICE)
- self.sideband.message_router.cancel_all_inbound()
+ self.sideband.cancel_all_inbound()
def incoming_messages_action(self, sender=None):
hs = dp(22)
@@ -3032,9 +3009,7 @@ class SidebandApp(MDApp):
cancel_button.bind(on_release=cb_cancel)
dialog.open()
- if self.incoming_messages_updater != None:
- self.incoming_messages_updater.cancel()
-
+ if self.incoming_messages_updater != None: self.incoming_messages_updater.cancel()
self.incoming_messages_updater = Clock.schedule_interval(im_updater, 1.0)
def get_connectivity_text(self):

diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py
index a33b6717..e412bdea 100644
--- a/sbapp/sideband/core.py
+++ b/sbapp/sideband/core.py
@@ -2082,6 +2082,9 @@ class SidebandCore():
elif "get_lxm_progress" in call: connection.send(self.get_lxm_progress(call["get_lxm_progress"]["lxm_hash"]))
elif "get_lxm_stamp_cost" in call: connection.send(self.get_lxm_stamp_cost(call["get_lxm_stamp_cost"]["lxm_hash"]))
elif "get_lxm_propagation_cost" in call: connection.send(self.get_lxm_propagation_cost(call["get_lxm_propagation_cost"]["lxm_hash"]))
+ elif "incoming_messages_status" in call: connection.send(self.incoming_messages_status())
+ elif "inbound_count" in call: connection.send(self.inbound_count())
+ elif "cancel_all_inbound" in call: connection.send(self.cancel_all_inbound())
elif "is_tracking" in call: connection.send(self.is_tracking(call["is_tracking"]))
elif "start_tracking" in call: connection.send(self.start_tracking(object_addr=call["start_tracking"]["object_addr"], interval=call["start_tracking"]["interval"], duration=call["start_tracking"]["duration"]))
elif "stop_tracking" in call: connection.send(self.stop_tracking(object_addr=call["stop_tracking"]["object_addr"]))
@@ -4765,6 +4768,95 @@ class SidebandCore():
else:
return False
+ def _service_cancel_all_inbound(self):
+ if not RNS.vendor.platformutils.is_android(): return False
+ else:
+ if self.is_client:
+ try: return self.service_rpc_request({"cancel_all_inbound": True })
+ except Exception as e:
+ RNS.log("Error while cancelling inbound messages over RPC: "+str(e), RNS.LOG_DEBUG)
+ RNS.trace_exception(e)
+ return 0
+
+ else: return 0
+
+ def cancel_all_inbound(self):
+ if self.allow_service_dispatch and self.is_client:
+ try: return self._service_cancel_all_inbound()
+ except Exception as e:
+ RNS.log(f"Error while cancelling inbound messages: {e}", RNS.LOG_ERROR)
+ RNS.trace_exception(e)
+ return 0
+
+ else: return self.message_router.cancel_all_inbound()
+
+ def _service_inbound_count(self):
+ if not RNS.vendor.platformutils.is_android(): return False
+ else:
+ if self.is_client:
+ try: return self.service_rpc_request({"inbound_count": True })
+ except Exception as e:
+ RNS.log("Error while getting inbound count over RPC: "+str(e), RNS.LOG_DEBUG)
+ RNS.trace_exception(e)
+ return False
+
+ else: return False
+
+ def inbound_count(self):
+ if self.allow_service_dispatch and self.is_client:
+ try: return self._service_inbound_count()
+ except Exception as e:
+ RNS.log(f"Error while getting incoming messages status: {e}", RNS.LOG_ERROR)
+ RNS.trace_exception(e)
+ return f"Error while getting incoming messages status: {e}"
+
+ else: return self.message_router.inbound_count()
+
+ def _service_incoming_messages_status(self):
+ if not RNS.vendor.platformutils.is_android(): return False
+ else:
+ if self.is_client:
+ try: return self.service_rpc_request({"incoming_messages_status": True })
+ except Exception as e:
+ RNS.log("Error while getting incoming messages status over RPC: "+str(e), RNS.LOG_DEBUG)
+ RNS.trace_exception(e)
+ return False
+
+ else: return False
+
+ def incoming_messages_status(self):
+ if self.allow_service_dispatch and self.is_client:
+ try: return self._service_incoming_messages_status()
+ except Exception as e:
+ RNS.log(f"Error while getting incoming messages status: {e}", RNS.LOG_ERROR)
+ RNS.trace_exception(e)
+ return f"Error while getting incoming messages status: {e}"
+ else:
+ try:
+ if not self.message_router: return "LXMF router starting..."
+ else:
+ inbound_count = self.message_router.inbound_count()
+ if inbound_count == 0: return "No incoming messages"
+ else:
+ inbound = self.message_router.inbound_resources()
+ if len(inbound) == 0: return "No incoming messages"
+ else:
+ text = f"[b]Receiving {inbound_count} message resource{'s' if inbound_count != 1 else ''}[/b]"
+ size = 0
+ prgr = 0
+ for r in inbound:
+ size += r.get_data_size()
+ prgr += r.get_progress()
+
+ prgr = prgr/len(inbound)
+ text += f"\nTotal size : {RNS.prettysize(size)}"
+ text += f"\nProgress : {round(prgr*100, 2)}%"
+ return text
+
+ except Exception as e:
+ RNS.log(f"Error getting incoming messages information: {e}", RNS.LOG_ERROR)
+ return "Error getting incoming messages information"
+
def cancel_message(self, message_id):
if self.allow_service_dispatch and self.is_client:
try:

diff --git a/sbapp/ui/conversations.py b/sbapp/ui/conversations.py
index fd2d66b4..565e5d20 100644
--- a/sbapp/ui/conversations.py
+++ b/sbapp/ui/conversations.py
@@ -293,8 +293,8 @@ class Conversations():
toolbar_items = self.screen.ids.conversations_bar.ids.right_actions.children
if len(toolbar_items) >= 6:
im_button = toolbar_items[2]
- if self.app.sideband.message_router.inbound_count() > 0: im_button.icon = "email-arrow-left-outline"
- else: im_button.icon = "progress-download"
+ if self.app.sideband.inbound_count() > 0: im_button.icon = "email-arrow-left-outline"
+ else: im_button.icon = "progress-download"
def trust_icon(self, conv):
conv_type = conv["type"]


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────